package 笔试.顺丰;

import java.util.Scanner;

//最短路径中的最大边
public class Demo2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); //节点数
        int m = sc.nextInt(); //边数
        int q = sc.nextInt(); //询问次数
        int[][] nums = new int[m][3]; //边相邻两个节点，不舒适度
        int[][] query = new int[q][2]; //起点和终点
        for (int i = 0; i < m; i++) {
            nums[i][0] = sc.nextInt();
            nums[i][1] = sc.nextInt();
            nums[i][2] = sc.nextInt();
        }

        for (int i = 0; i < q; i++) {
            query[i][0] = sc.nextInt();
            query[i][1] = sc.nextInt();
            System.out.println(getMax(nums, query[i][0], query[i][1]));
        }
    }

    public static int getMax(int[][] nums,int start,int end){
        int max = 0;
        for (int i = start; i <end ; i++) {
            max = Math.max(max,nums[i-1][2]);
        }
        return max;
    }
}
